package com.meietling;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Test extends JFrame {
    public void createJFrame(String title){
        JFrame jFrame = new JFrame();
        Container container = jFrame.getContentPane();
        JLabel jLabel = new JLabel("aaaaaa");
        final JButton jButton = new JButton("阿这");
        jButton.setBounds(10,10,100,21);
        jButton.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent e) {
                jButton.setText("哎嘿");
            }
        });


        container.add(jLabel);
        container.add(jButton);
        jFrame.setSize(400,200);
        jFrame.setBackground(Color.CYAN);
        jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        jFrame.setVisible(true);
    }

    public static void main(String[] args) {
        new Test().createJFrame("JFrame");
    }
}
